formatRate

fun formatRate(rate: Double, decimalChar: Char, maxDecPlaces: Int? = null, fillZeroes: Boolean = false): String

Format a Double with a maximum of maxDecimalPlaces decimal places, while truncating any trailing zeroes, and ensuring that there are at least minDecPlaces displayed

Parameters

rate

the Double value to format as a string

decimalChar

the decimal point character to be used: either '.' or ','

maxDecPlaces

the maximum number of decimal places to include in the string value. If null, the number of decimal places is determined based on the magnitude of the rate parameter

fillZeroes

if true, fill in any trailing zeroes up to maxDecimalPlaces (or the automatically determined number of decimal places)


fun formatRate(rate: BigDecimal, decimalChar: Char): String

Format a BigDecimal

Since

MD2027

Parameters

rate

the Double value to format as a string

decimalChar

the decimal point character to be used: either '.' or ','